#include "Pared.h"

#include <glm\gtc\matrix_transform.hpp>


Pared::Pared(float ancho, float alto) : 
	m_ancho(ancho), m_alto(alto), 
	m_placaexterna(ancho, alto), 
	m_placainterna(ancho, alto)
{
}


void Pared::init(const glm::vec3 &DireccionLuz){
	this->m_placaexterna.init(DireccionLuz, "TexturingBumpDiffuseShading.vert", "TexturingBumpDiffuseShading.frag");	/*
	this->m_placaexterna.init(DireccionLuz, "ShadowRealmShader.vert", "ShadowRealmShader.frag");	// */

	this->m_placaexterna.setMaterial( glm::vec3(0.75f, 0.678f, 0.537f), glm::vec3(0.187f, 0.17f, 0.13f), glm::vec3(0.375f, 0.34f, 0.27f), 2.0f );
	this->m_placaexterna.setTextura("ladrillos.dds");
	this->m_placaexterna.setNormalMap("ladrillos_normalmap.dds");

	this->m_placainterna.init(DireccionLuz, "ShadowTextureShader.vert", "ShadowTextureShader.frag");
	this->m_placainterna.setMaterial( glm::vec3(0.517f, 0.423f, 0.408f), glm::vec3(0.13f, 0.105f, 0.102f), glm::vec3(0.26f, 0.21f, 0.204f), 3.0f );
	this->m_placainterna.setTextura("ParedLadrillo.dds");
}


void Pared::renderizar(const glm::mat4 &matVista, const glm::mat4 &matProyeccion, const glm::mat4 &matModelo) const {
	glm::mat4 matModelPlacaExterna = glm::translate(matModelo, glm::vec3(0.0f, 0.0f, 0.0f));
	this->m_placaexterna.renderizar(matVista, matProyeccion, matModelPlacaExterna);

	glm::mat4 matModelPlacaInterna = glm::translate(matModelo, glm::vec3(-0.1f, this->m_ancho, 0.0f));
	matModelPlacaInterna = glm::rotate(matModelPlacaInterna, 180.0f, glm::vec3(0.0f, 0.0f, 1.0f));
	this->m_placainterna.renderizar(matVista, matProyeccion, matModelPlacaInterna);
}